package com.city.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: Cheng
 * Date: 2020/4/20
 * Time: 22:29
 * Description: No Description
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    @TableId(type = IdType.AUTO)//数据库为勾选id自增，可在变量前配置自增方式-----mybatis默认使用雪花算法生成id---字段设置自增在数据库表中也要设置自增
    private Long id;
    private String name;
    private Integer age;
    private String email;

    //乐观锁
    @Version
    private int version;

    @TableLogic //逻辑删除
    private int deleted;

    //添加mybatisplus自动创建创建时间
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)//mybatisplus的自动填充需要自己完成过滤器
    private Date updateTime;
}
